// 配置路由 
import Vue from "vue"
// 1、引入路由对象
import VueRouter from "vue-router"
// 2、使用Vue.use注册相关组件等
Vue.use(VueRouter)
// 3、创建路由规则
const routes = [
    {
        // 重定向登录页面
        path: "/",
        redirect: '/index'
    },
    {
        path: "/login",
        // @是src这个目录的别名
        component: ()=>import("../views/login.vue") // 按需引入
    },{
        // 配置路由
        path:'/register',
        component:()=>import('../views/register.vue')
    },{
        path:'/personal',
        component:()=>import('../views/personal.vue')
    },{
        path:'/edit_profile',
        component:()=>import('../views/edit_profile.vue')
    },{
        // 跳转到首页
        path:'/index',
        component:()=>import('@/views/index.vue')
    },{
        path:'/articleDetail',
        component:()=>import('@/views/articleDetail.vue')
    },{
        path:'/comment',
        component:()=>import('@/views/comment.vue')
    },{
        // 我的关注
        path:'/myFollow',
        component:()=>import('@/views/myFollow.vue')
    },{
        // 我的收藏
        path:'/myStar',
        component:()=>import('@/views/myStar.vue')
    },{
        // 搜索文章
        path:'/search',
        component:()=>import('@/views/search.vue')
    }
]
// 4、使用路由规则生成路由对象
const router = new VueRouter({
    // routes: routes, 简写如下
    routes:routes
})
// 5、导出路由对象
export default router